#ifndef PROCESS_H
#define PROCESS_H

#include "MMU.cpp"

using namespace std;

//  Return values
const int PRET_SUCCESS             = 0; // No errors, ready for next
                                        // execution

const int PRET_PAGE_FAULT          = 1; // Page fault, fixed. Required 
                                        // to pass PF to osMain
                                        // to increment tick

const int PRET_END_PROCESS         = 2; // Reached EOF

const int PRET_PAGE_FAULT_DIRTY    = 3; // Page fault, fixed, removed dirty page

const int PRET_ERROR               = -1; // Assorted error, end execution


class Process {
 private:
  char code_loc [256];
  FILE* f;
  MMU* mmu;
  PageTable* pt;
  int base;
  int bound;
  int ptick; // Holds number of ticks specific to process
  int counter;


 public:
  Process(char icode_loc [256]);
  int run(int tick);
  void close();
  void setPageTable(PageTable *p) { (*(pt)) = *p; }
  PageTable* returnPageTable() { return pt; };
  void addMMU(MMU* immu) { mmu = immu; };
  void setBase(int ibase) { base = ibase; };
  void setBound(int ibound) { bound = ibound; };
  int getBase() { return base;};
  int getBound() { return bound;};
};

#endif
